static LIST_HEAD(watches);
static DEFINE_SPINLOCK(watches_lock);
+static struct workqueue_struct *watches_workq;
static int get_error(const char *errorstring)
{
up_read(&xs_state.suspend_mutex);
/* Make sure watch is not in use. */
- flush_scheduled_work();
+ flush_workqueue(watches_workq);
}
EXPORT_SYMBOL(unregister_xenbus_watch);
msg->u.watch.handle = find_watch(
msg->u.watch.vec[XS_WATCH_TOKEN]);
if (msg->u.watch.handle != NULL) {
- schedule_work(&msg->u.watch.work);
+ queue_work(watches_workq, &msg->u.watch.work);
} else {
kfree(msg->u.watch.vec);
kfree(msg);
}
}
-/*
-** Initialize the interface to xenstore.
-*/
int xs_init(void)
{
int err;
err = xb_init_comms();
if (err)
return err;
-
- reader = kthread_run(read_thread, NULL, "xenbusd");
+
+ /* Create our own workqueue for executing watch callbacks. */
+ watches_workq = create_singlethread_workqueue("xenwatch");
+ BUG_ON(watches_workq == NULL);
+
+ reader = kthread_run(read_thread, NULL, "xenbus");
if (IS_ERR(reader))
return PTR_ERR(reader);